<template>
        <el-breadcrumb separator-class="el-icon-arrow-right">
        <!-- <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item> -->
        <el-breadcrumb-item :to="{path:getBreadcrumb.path}" v-for="item in getBreadcrumb" :key="item.path">
            {{item.meta.title}}
          </el-breadcrumb-item>
        </el-breadcrumb>
</template>

<script>
export default {
    data() {
        return {
            levelList:[]
        }
    },
    computed: {
         getBreadcrumb() {
                let matched = this.$route.matched.filter(item => item.meta)  //获取路由信息，并过滤保留路由名称信息存入数组
                // console.log(this.$route.matched);
                this.levelList = matched
                // console.log(matched)
                return matched
            }
    },
    created() {
        // this.getBreadcrumb()
    },
    watch: {
            // $route() {
            //     this.getBreadcrumb()  //监听路由变化
            // }
        },
    
    methods: {
       
    },
    

}
</script>

<style>

</style> 